<?php
/**
 * Created by PhpStorm.
 * User: lenovo
 * Date: 2020/6/17
 * Time: 9:56
 */

namespace App\Logic;


use App\Model\BlacklistModel;
use App\Services\ReponseCodeService;

class BlacklistLogic
{
    /**是否是黑名单
     * @param $userId
     * @param $dislikeUserId
     * @return int
     */
    function isBlacklist($userId,$dislikeUserId){
        try{
            if(BlacklistModel::create()->get(['user_id'=>$userId,'dislike_user_id'=>$dislikeUserId])){
                return ReponseCodeService::CODE_BLACK_LIST;
            }
        }catch(\Throwable $t){
            return ReponseCodeService::CODE_DB_ERROR;
        }
        return false;
    }
}